<html>
<head><meta charset="utf-8"><title>const eval within attributes · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html">const eval within attributes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209325442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209325442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209325442">(Sep 07 2020 at 20:21)</a>:</h4>
<p>In a <a href="https://github.com/rust-lang/lang-team/pull/43">lang-team project group proposal</a> it came up that it would be extremely nice to some day be able to write:</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#[repr(align(/* some const expression that makes a usize value*/))]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">MyType</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>


<ul>
<li>It seems like this would be fairly simple to do within the current compiler for non-generic expressions.</li>
<li>It seems like this would be <em>possible</em> to do some day even if there are generics involved.</li>
</ul>
<p>But we wanted to get some feedback about the feasibility of such a thing from the const eval people. Thoughts?</p>



<a name="209327532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209327532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209327532">(Sep 07 2020 at 21:02)</a>:</h4>
<p>Concretely, it'd be nice to write <code>#[repr(align(align_of::&lt;*const u8&gt;()))]</code>, for instance.</p>



<a name="209332626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209332626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209332626">(Sep 07 2020 at 23:00)</a>:</h4>
<p>I wonder whether there are grammar questions here too -- can we parse an arbitrary expression at that point in attributes, for example?</p>
<p>Part of me thinks that once it can be a full expression, it would be better off in something not an attribute -- maybe an associated const -- because it'll want full error reporting, clippy lints applied, ...</p>



<a name="209333248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209333248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209333248">(Sep 07 2020 at 23:12)</a>:</h4>
<p>well maybe it should be an identifier, and then the identifier can be any const you've defined anywhere you like.</p>



<a name="209338121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209338121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209338121">(Sep 08 2020 at 01:18)</a>:</h4>
<p>Sketch of a thing I'd be curious to see what people hate about it:</p>
<div class="codehilite"><pre><span></span><code><span class="k">impl</span><span class="w"> </span><span class="n">repr</span>::<span class="n">Align</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">ALIGN</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="mi">8</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>(Has the interesting behaviour that the attribute could expand to that, and coherence gives all the "you can't have multiple impls" stuff.  Obviously it's really long, but...)</p>



<a name="209345802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209345802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209345802">(Sep 08 2020 at 04:55)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> That's...not the worst thing ever, but it's pretty quirky. :)</p>



<a name="209345848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209345848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209345848">(Sep 08 2020 at 04:56)</a>:</h4>
<p>But the idea of making it an identifier to avoid parsing complexity isn't unreasonable. Though I think the grammar <em>would</em> allow an arbitrary expression there; I don't know what it'd be ambiguous with.</p>



<a name="209346899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209346899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Braden Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209346899">(Sep 08 2020 at 05:22)</a>:</h4>
<p>What about the potential cyclic loops? I assume they'd need special handling with that idea?</p>
<div class="codehilite"><pre><span></span><code><span class="k">impl</span><span class="w"> </span><span class="n">repr</span>::<span class="n">Align</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">ALIGN</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="n">align_of</span>::<span class="o">&lt;</span><span class="n">Bar</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">repr</span>::<span class="n">Align</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Bar</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">ALIGN</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="n">align_of</span>::<span class="o">&lt;</span><span class="n">Foo</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>But with traits in particular, align_of could probably then be implemented in terms of repr::Align instead, so existing compiler infrastructure could handle the dependency.</p>



<a name="209348336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209348336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209348336">(Sep 08 2020 at 06:00)</a>:</h4>
<p><span class="user-mention" data-user-id="277614">@Braden Nelson</span> Cyclic definitions are possible today with const evaluation, I believe.</p>



<a name="209349294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209349294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Braden Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209349294">(Sep 08 2020 at 06:23)</a>:</h4>
<p>I'm aware. The compiler is smart enough to handle them in normal situations (cycle detection). align_of would need some level of specialty handling if it's in any way built "outside" the current systems, as far as I can tell.</p>



<a name="209349855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209349855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209349855">(Sep 08 2020 at 06:34)</a>:</h4>
<p>(I've also often wished that it was <code>&lt;T as Something&gt;::ALIGN</code> instead of <code>align_of::&lt;T&gt;()</code> to get alignment of things, but that's probably not worth churning.)</p>



<a name="209410515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209410515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Wrenn <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209410515">(Sep 08 2020 at 16:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224471">Lokathor</span> <a href="#narrow/stream/146212-t-compiler.2Fconst-eval/topic/const.20eval.20within.20attributes/near/209325442">said</a>:</p>
<blockquote>
<p>In a <a href="https://github.com/rust-lang/lang-team/pull/43">lang-team project group proposal</a> it came up that it would be extremely nice to some day be able to write:</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#[repr(align(/* some const expression that makes a usize value*/))]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">MyType</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>


<ul>
<li>It seems like this would be fairly simple to do within the current compiler for non-generic expressions.</li>
<li>It seems like this would be <em>possible</em> to do some day even if there are generics involved.</li>
</ul>
<p>But we wanted to get some feedback about the feasibility of such a thing from the const eval people. Thoughts?</p>
</blockquote>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=66801018f8aa2447b41d4c0099bd1d88">Here's a demonstration of how this can be accomplished with the current capabilities of const generics.</a></p>



<a name="209410690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209410690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209410690">(Sep 08 2020 at 16:25)</a>:</h4>
<p>Clever!</p>



<a name="209412043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209412043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209412043">(Sep 08 2020 at 16:35)</a>:</h4>
<p>A downside of requiring an identifier is that there'd be no way to mention generic parameters.  Lokathor suggested this may not be supported in an initial implementation anyway, but it's still desirable to support someday.  Although it <em>would</em> make for somewhat awkward syntax: you'd be mentioning generic parameters before they're declared, textually speaking (<code>#[repr(align(align_of::&lt;T&gt;()))] struct Foo&lt;T&gt; …</code>)</p>



<a name="209412930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209412930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209412930">(Sep 08 2020 at 16:43)</a>:</h4>
<p>Part of this reminds me of the situation with <code>PhantomData</code>.  After all, in theory, we could say: repr align will never be extended; instead we'll add a type like in <span class="user-mention" data-user-id="219211">@Jack Wrenn</span>'s demo to the standard library and have that be the official way to achieve alignment depending on an expression.  One major downside would of course be inconsistency.  But another would be the same problem that <code>PhantomData</code> has: dummy fields make it annoying to construct and destructure structs!</p>



<a name="209413170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209413170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> comex <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209413170">(Sep 08 2020 at 16:45)</a>:</h4>
<p>On the flipside, if we go with supporting expressions in the existing repr-align attribute, perhaps someday PhantomData could also become an attribute.</p>



<a name="209413396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209413396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Wrenn <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209413396">(Sep 08 2020 at 16:47)</a>:</h4>
<p>"Phantom fields"—fields that affect layout and capture type parameters but don't impede construction or destructuring—is a neat thought!</p>



<a name="209413721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209413721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Wrenn <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209413721">(Sep 08 2020 at 16:50)</a>:</h4>
<p>Separately: I want to note that there <em>isn't</em> really an equivalent trick for <code>repr(packed(N))</code>. Fields can only increase the alignment of the type they're in, not decrease it. An equivalent <code>packed(N)</code> hack would need to <em>wrap</em> the annotated type in an archetype that constraints its alignment.</p>
<p>You could do it, but it would be even more un-ergonomic than the <code>_align</code> field of my demo.</p>



<a name="209415110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209415110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209415110">(Sep 08 2020 at 17:01)</a>:</h4>
<p>Phantom fields could also allow <code>Ok()</code> to become <code>Ok(())</code> and such, if we wanted.  And if they were restricted to <code>Default + Copy + StableTransmuteFrom&lt;()&gt;</code> I don't think anyone could complain about them holding useful information...</p>



<a name="209415306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209415306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Wrenn <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209415306">(Sep 08 2020 at 17:02)</a>:</h4>
<blockquote>
<p>StableTransmuteFrom&lt;()&gt;</p>
</blockquote>
<p>Heh, nice trick ya got there. <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="209425070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209425070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209425070">(Sep 08 2020 at 18:24)</a>:</h4>
<p>maybe use some syntax like:</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">MyStruct</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">_</span>: <span class="nc">PhantomData</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="209591648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209591648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209591648">(Sep 10 2020 at 03:04)</a>:</h4>
<p>repr traits sound like cool ideas, since it makes the data immediate to rather than a side effect of the type system.</p>



<a name="209594152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209594152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209594152">(Sep 10 2020 at 04:05)</a>:</h4>
<p>my concern is not "does this cycle?" but rather "is this a reasonable promise in terms of the type system?"</p>



<a name="209601374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209601374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209601374">(Sep 10 2020 at 06:51)</a>:</h4>
<p>Well the instant I say "I can't imagine what you could possibly do by being generic over things with a minimum alignment of 4" I'm sure someone will nerdsnipe me with an example.</p>



<a name="209686045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209686045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Braden Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209686045">(Sep 10 2020 at 18:07)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> bytemuck-ish. <code>cast&lt;A: Pod,B: Pod&gt; where A::Align::ALIGN = B::Align::ALIGN</code></p>



<a name="209686308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209686308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209686308">(Sep 10 2020 at 18:09)</a>:</h4>
<p>owned transmute doesn't actually need alignment similarly at all, though that reminds me that a vec transmute might use it</p>



<a name="209686904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209686904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209686904">(Sep 10 2020 at 18:12)</a>:</h4>
<p>Also tagged pointers care greatly -- <code>CompressedReferenceAndBool</code> needs <code>Align &gt;= 2</code></p>



<a name="209715312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20eval%20within%20attributes/near/209715312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20eval.20within.20attributes.html#209715312">(Sep 10 2020 at 22:02)</a>:</h4>
<p>SIMD cares a lot about alignment too for obvious reasons, though my brain hasn't figured out to turn this into a nerdsnipey thing yet.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>